#include <boost/gil/image.hpp>
#include "../gil/step_view.hpp"
#include "../ged/typedefs.hpp"
#include "ImageLayer.hpp"

namespace gil = boost::gil;

namespace ged {

ImageLayer::ImageLayer(PGILImage image)
	: image_(image), offset_(GILPoint(0, 0))
{
	// Inicjujemy widok. Dalej będziemy operować jedynie
	// na rgb8_step_view_t.
	view_ = gil::step_view(gil::view(*image_));
}

const ImageLayer::view_type ImageLayer::getView() const
{
	return view_;
}

void ImageLayer::setView(const view_type& view)
{
	view_ = view;
}

void ImageLayer::setOffset(const GILPoint& offset)
{
	offset_ = offset;
}

const GILPoint ImageLayer::getOffset() const
{
	return offset_;
}

const GILPoint ImageLayer::getDimensions() const
{
	return view_.dimensions();
}

ImageLayer::view_type::reference ImageLayer::operator()(const GILPoint& p) const
{
	return view_(p);
}

} // namespace ged
